package com.itheima.reggie.common;

public class BaseContext {

    //设置一个唯一的静态对象
    private static final ThreadLocal<Long> THREAD_LOCAL_USER_ID = new ThreadLocal<>();

    //定义方法 通过类调用ThreadLocal方法
//    public static ThreadLocal<Long> getThreadLocal() {
//
//        return THREAD_LOCAL_USER_ID;
//
//    }

    //获取id值
    public static void setCurrentId(Long id){
        THREAD_LOCAL_USER_ID.set(id);

    }
    //取出id值
    public static Long getCurrentId(){
        return THREAD_LOCAL_USER_ID.get();
    }
}
